import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import autoprefixer from 'autoprefixer'
// 支持符合W3C规范的嵌套类选择器写法
import postcssNesting from 'postcss-nesting';
//实现嵌套编程
import postcssCssnext from 'postcss-nesting';

import { resolve } from 'path'
const srcPath = resolve(__dirname, './src')
const comPath = resolve(__dirname, './src/components')
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue(),
   
  ],
  base:"./",
  define:{
    'process.env':{
      
    }
  },
  resolve: {
    alias: {
        '@/': `${srcPath}/`,
        '_components': `${comPath}/`
    }
  },
  // configureWebpack: {
  //   resolve: {
  //     alias: {
  //       components: '@/components'
  //     }
  //   }
  // },
  css:{
    devSourcemap:true,
    postcss:{
      plugins:[
        // postcssImport,
        autoprefixer,
        postcssNesting,
        postcssCssnext
        // tailwindcss
      ]
    }
  },
  server: {
    proxy: {
      '^/api': {
        target: 'https://court1.ptnetwork001.com/',
        pathRewrite: {
          '^/api': ''
        },
        changeOrigin: true,
        secure: false

      }
    }
  }
  
})
